package tinglema.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import tinglema.server.dao.AdminDao;
import tinglema.server.entity.domain.Admin;
import tinglema.server.service.AdminService;
import org.springframework.stereotype.Service;

/**
 * 管理员(Admin)表服务实现类
 *
 * @author delucia
 * @since 2025-03-19 20:42:21
 */
@Service("adminService")
public class AdminServiceImpl extends ServiceImpl<AdminDao, Admin> implements AdminService {

    @Override
    public boolean verifyPassword(Admin admin) {
        LambdaQueryWrapper<Admin> wrapper = new LambdaQueryWrapper<Admin>()
                .eq(Admin::getName, admin.getName())
                .eq(Admin::getPassword, admin.getPassword());
        Long count = this.getBaseMapper().selectCount(wrapper);

        return count > 0;
    }
}

